import request from '@/utils/request'

// 查询草处方列表
export function listHerbal_prescription_record(query) {
  return request({
    url: '/dms/herbal_prescription_record/list',
    method: 'get',
    params: query
  })
}


// 查询草药模板
export function getHerbalModel() {
  return request({
    url: '/dms/herbal_prescription_record/getHerbalModel',
    method: 'get',
  })
}

// 查询草处方详细
export function getHerbal_prescription_record(id) {
  return request({
    url: '/dms/herbal_prescription_record/' + id,
    method: 'get'
  })
}

//开立处方
export function addHerbal_prescription_record(data) {
  return request({
    url: '/dms/herbal_prescription_record/addToDataBase?preName='+data,
    method: 'get'
  })
}

// 修改草处方
export function updateHerbal_prescription_record(data) {
  return request({
    url: '/dms/herbal_prescription_record',
    method: 'put',
    data: data
  })
}

// 判断处方名称是否重复
export function  getPrescriptionName(data) {
  return request({
    url: '/dms/herbal_prescription_record/judgmentName?name='+data,
    method: 'get',
  })
}

// 删除草处方
export function delHerbal_prescription_record(names) {
  return request({
    url: '/dms/herbal_prescription_record/remove?preName=' + names,
    method: 'get'
  })
}

// 作废草处方
export function invalidToDataBase(ids,status) {
  return request({
    url: '/dms/herbal_prescription_record/invalidToDataBase?ids='+ids+'&status='+status,
    method: 'get'

  })
}

// 导出草处方
export function exportHerbal_prescription_record(query) {
  return request({
    url: '/dms/herbal_prescription_record/export',
    method: 'get',
    params: query
  })
}

// 修改草处方(发药)
export function updateHerbal_prescription_records(data) {
  return request({
    url: '/dms/herbal_prescription_record/edits',
    method: 'put',
    data: data
  })
}

// 修改草处方(发药)
export function herbalWithdrawal(data) {
  return request({
    url: '/dms/herbal_prescription_record/herbalWithdrawal',
    method: 'put',
    data: data
  })
}


//根据药品模板id添加一个处方
export function getModelItemByModelID(query) {
  return request({
    url: '/dms/herbal_prescription_record/query/' + query,
    method: 'get',

  })
}

  //添加处方到redis
  export function addHerbal_prescriptionToRedis(data) {
    return request({
      url: '/dms/herbal_prescription_record/addToRedis',
      method: 'post',
      data: data
    })
}

//添加处方到redis
export function addHerbal_prescriptionBulu(data) {
  return request({
    url: '/dms/herbal_prescription_record/add',
    method: 'post',
    data: data
  })
}

